Replace most `.__proto__` with `Object.getPrototypeOf()` (#27394) Co-authored-by: Philip Jägenstedt <philip@foolip.org>
diff --git a/IndexedDB/structured-clone.any.js b/IndexedDB/structured-clone.any.js index de633e6..bb469a9 100644 --- a/IndexedDB/structured-clone.any.js +++ b/IndexedDB/structured-clone.any.js
@@ -15,7 +15,7 @@ function describe(value) { let type, str; if (typeof value === 'object' && value) { - type = value.__proto__.constructor.name; + type = Object.getPrototypeOf(value).constructor.name; // Handle Number(-0), etc. str = Object.is(value.valueOf(), -0) ? '-0' : String(value); } else { @@ -54,7 +54,7 @@ cloneTest(value, async (orig, clone) => { assert_not_equals(orig, clone); assert_equals(typeof clone, 'object'); - assert_equals(orig.__proto__, clone.__proto__); + assert_equals(Object.getPrototypeOf(orig), Object.getPrototypeOf(clone)); await verifyFunc(orig, clone); }); } @@ -141,7 +141,7 @@ ].forEach(value => cloneTest(value, (orig, clone) => { assert_not_equals(orig, clone); assert_equals(typeof clone, 'object'); - assert_equals(orig.__proto__, clone.__proto__); + assert_equals(Object.getPrototypeOf(orig), Object.getPrototypeOf(clone)); assert_equals(orig.valueOf(), clone.valueOf()); })); @@ -261,7 +261,7 @@ new DOMRect, new DOMRectReadOnly(), ].forEach(value => cloneObjectTest(value, (orig, clone) => { - Object.keys(orig.__proto__).forEach(key => { + Object.keys(Object.getPrototypeOf(orig)).forEach(key => { assert_equals(orig[key], clone[key], `Property ${key}`); }); })); diff --git a/custom-elements/upgrading.html b/custom-elements/upgrading.html index ac0fdff..9a28fcb 100644 --- a/custom-elements/upgrading.html +++ b/custom-elements/upgrading.html
@@ -41,20 +41,20 @@ var name = generateNextCustomElementName(); var unresolvedElement = document.createElement(name); - assert_equals(unresolvedElement.__proto__, HTMLElement.prototype, + assert_equals(Object.getPrototypeOf(unresolvedElement), HTMLElement.prototype, '[[Prototype]] internal slot of the unresolved custom element must be the HTMLElement prototype'); return getDocument().then(function (doc) { var unresolvedElementInDoc = doc.createElement(name); var prototype = (unresolvedElementInDoc.namespaceURI == 'http://www.w3.org/1999/xhtml' ? HTMLElement : Element).prototype; - assert_equals(unresolvedElementInDoc.__proto__, prototype, + assert_equals(Object.getPrototypeOf(unresolvedElementInDoc), prototype, '[[Prototype]] internal slot of the unresolved custom element must be the ' + prototype.toString() + ' prototype'); var someCustomElement = class extends HTMLElement {}; customElements.define(name, someCustomElement); - assert_equals(unresolvedElementInDoc.__proto__, prototype, '"define" must not upgrade a disconnected unresolved custom elements'); + assert_equals(Object.getPrototypeOf(unresolvedElementInDoc), prototype, '"define" must not upgrade a disconnected unresolved custom elements'); doc.documentElement.appendChild(unresolvedElementInDoc); - assert_equals(unresolvedElementInDoc.__proto__, prototype, + assert_equals(Object.getPrototypeOf(unresolvedElementInDoc), prototype, 'Inserting an element into a document without a browsing context must not enqueue a custom element upgrade reaction'); }); }, 'Creating an element in ' + documentName + ' and inserting into the document must not enqueue a custom element upgrade reaction'); @@ -63,25 +63,25 @@ var name = generateNextCustomElementName(); var unresolvedElement = document.createElement(name); - assert_equals(unresolvedElement.__proto__, HTMLElement.prototype, + assert_equals(Object.getPrototypeOf(unresolvedElement), HTMLElement.prototype, '[[Prototype]] internal slot of the unresolved custom element must be the HTMLElement prototype'); return getDocument().then(function (doc) { var unresolvedElementInDoc = doc.createElement(name); var prototype = (unresolvedElementInDoc.namespaceURI == 'http://www.w3.org/1999/xhtml' ? HTMLElement : Element).prototype; - assert_equals(unresolvedElementInDoc.__proto__, prototype, + assert_equals(Object.getPrototypeOf(unresolvedElementInDoc), prototype, '[[Prototype]] internal slot of the unresolved custom element must be the ' + prototype.toString() + ' prototype'); var someCustomElement = class extends HTMLElement {}; customElements.define(name, someCustomElement); - assert_equals(unresolvedElementInDoc.__proto__, prototype, '"define" must not upgrade a disconnected unresolved custom elements'); + assert_equals(Object.getPrototypeOf(unresolvedElementInDoc), prototype, '"define" must not upgrade a disconnected unresolved custom elements'); document.body.appendChild(unresolvedElementInDoc); if (unresolvedElementInDoc.namespaceURI == 'http://www.w3.org/1999/xhtml') { - assert_equals(unresolvedElementInDoc.__proto__, someCustomElement.prototype, + assert_equals(Object.getPrototypeOf(unresolvedElementInDoc), someCustomElement.prototype, 'Inserting an element into a document with a browsing context must enqueue a custom element upgrade reaction'); } else { - assert_equals(unresolvedElementInDoc.__proto__, prototype, + assert_equals(Object.getPrototypeOf(unresolvedElementInDoc), prototype, 'Looking up a custom element definition must return null if the element is not in the HTML namespace'); } }); @@ -116,13 +116,13 @@ class UnresolvedElement extends docWindow.HTMLElement { }; var unresolvedElementInDoc = doc.createElement('unresolved-element'); - assert_equals(unresolvedElement.__proto__, HTMLElement.prototype); - assert_equals(unresolvedElementInDoc.__proto__, docWindow.HTMLElement.prototype); + assert_equals(Object.getPrototypeOf(unresolvedElement), HTMLElement.prototype); + assert_equals(Object.getPrototypeOf(unresolvedElementInDoc), docWindow.HTMLElement.prototype); docWindow.customElements.define('unresolved-element', UnresolvedElement); - assert_equals(unresolvedElement.__proto__, HTMLElement.prototype); - assert_equals(unresolvedElementInDoc.__proto__, docWindow.HTMLElement.prototype); + assert_equals(Object.getPrototypeOf(unresolvedElement), HTMLElement.prototype); + assert_equals(Object.getPrototypeOf(unresolvedElementInDoc), docWindow.HTMLElement.prototype); }); }, '"define" in ' + documentName + ' must not enqueue a custom element upgrade reaction on a disconnected unresolved custom element'); @@ -134,14 +134,14 @@ class UnresolvedElement extends docWindow.HTMLElement { }; var unresolvedElementInDoc = doc.createElement('unresolved-element'); - assert_equals(unresolvedElement.__proto__, HTMLElement.prototype); - assert_equals(unresolvedElementInDoc.__proto__, docWindow.HTMLElement.prototype); + assert_equals(Object.getPrototypeOf(unresolvedElement), HTMLElement.prototype); + assert_equals(Object.getPrototypeOf(unresolvedElementInDoc), docWindow.HTMLElement.prototype); docWindow.customElements.define('unresolved-element', UnresolvedElement); doc.documentElement.appendChild(unresolvedElementInDoc); - assert_equals(unresolvedElement.__proto__, HTMLElement.prototype); - assert_equals(unresolvedElementInDoc.__proto__, UnresolvedElement.prototype); + assert_equals(Object.getPrototypeOf(unresolvedElement), HTMLElement.prototype); + assert_equals(Object.getPrototypeOf(unresolvedElementInDoc), UnresolvedElement.prototype); }); }, 'Inserting an unresolved custom element into ' + documentName + ' must enqueue a custom element upgrade reaction'); @@ -153,13 +153,13 @@ var unresolvedElementInDoc = doc.createElement('unresolved-element'); doc.documentElement.appendChild(unresolvedElementInDoc); - assert_equals(unresolvedElement.__proto__, HTMLElement.prototype); - assert_equals(unresolvedElementInDoc.__proto__, docWindow.HTMLElement.prototype); + assert_equals(Object.getPrototypeOf(unresolvedElement), HTMLElement.prototype); + assert_equals(Object.getPrototypeOf(unresolvedElementInDoc), docWindow.HTMLElement.prototype); docWindow.customElements.define('unresolved-element', UnresolvedElement); - assert_equals(unresolvedElement.__proto__, HTMLElement.prototype); - assert_equals(unresolvedElementInDoc.__proto__, UnresolvedElement.prototype); + assert_equals(Object.getPrototypeOf(unresolvedElement), HTMLElement.prototype); + assert_equals(Object.getPrototypeOf(unresolvedElementInDoc), UnresolvedElement.prototype); }); }, '"define" in ' + documentName + ' must enqueue a custom element upgrade reaction on a connected unresolved custom element'); diff --git a/html/browsers/sandboxing/sandbox-new-execution-context-iframe.html b/html/browsers/sandboxing/sandbox-new-execution-context-iframe.html index dc15d57..801e78f 100644 --- a/html/browsers/sandboxing/sandbox-new-execution-context-iframe.html +++ b/html/browsers/sandboxing/sandbox-new-execution-context-iframe.html
@@ -1,5 +1,5 @@ <body> <script> - document.__proto__.changeFromSandboxedIframe = "change from sandboxed iframe"; + Object.getPrototypeOf(document).changeFromSandboxedIframe = "change from sandboxed iframe"; </script> -</body> \ No newline at end of file +</body>
diff --git a/html/browsers/sandboxing/sandbox-new-execution-context.html b/html/browsers/sandboxing/sandbox-new-execution-context.html index 6537293..dc1953a 100644 --- a/html/browsers/sandboxing/sandbox-new-execution-context.html +++ b/html/browsers/sandboxing/sandbox-new-execution-context.html
@@ -25,7 +25,7 @@ assert_equals(iframe.contentDocument, null, "New document in sandboxed iframe should have opaque origin"); - assert_equals(iframeAboutBlankDocument.__proto__.changeFromSandboxedIframe, undefined, + assert_equals(Object.getPrototypeOf(iframeAboutBlankDocument).changeFromSandboxedIframe, undefined, "Sandboxed iframe contents should not have been able to mess with type system of about:blank document"); let iframeAboutBlankContents = iframeAboutBlankDocument.querySelectorAll('body'); diff --git a/html/canvas/tools/yaml/element/the-canvas-element.yaml b/html/canvas/tools/yaml/element/the-canvas-element.yaml index 229451c..ec4c4e6 100644 --- a/html/canvas/tools/yaml/element/the-canvas-element.yaml +++ b/html/canvas/tools/yaml/element/the-canvas-element.yaml
@@ -151,7 +151,7 @@ testing: - 2d.path.contexttypexxx.basic code: | - @assert CanvasRenderingContext2D.prototype.__proto__ === Object.prototype; - @assert ctx.__proto__ === CanvasRenderingContext2D.prototype; + @assert Object.getPrototypeOf(CanvasRenderingContext2D.prototype) === Object.prototype; + @assert Object.getPrototypeOf(ctx) === CanvasRenderingContext2D.prototype; t.done();
diff --git a/html/semantics/embedded-content/the-canvas-element/2d.canvas.context.html b/html/semantics/embedded-content/the-canvas-element/2d.canvas.context.html index 1d231c4..b9d2601 100644 --- a/html/semantics/embedded-content/the-canvas-element/2d.canvas.context.html +++ b/html/semantics/embedded-content/the-canvas-element/2d.canvas.context.html
@@ -19,8 +19,8 @@ var t = async_test("checks CanvasRenderingContext2D prototype"); _addTest(function(canvas, ctx) { -_assertSame(CanvasRenderingContext2D.prototype.__proto__, Object.prototype, "CanvasRenderingContext2D.prototype.__proto__", "Object.prototype"); -_assertSame(ctx.__proto__, CanvasRenderingContext2D.prototype, "ctx.__proto__", "CanvasRenderingContext2D.prototype"); +_assertSame(Object.getPrototypeOf(CanvasRenderingContext2D.prototype), Object.prototype, "Object.getPrototypeOf(CanvasRenderingContext2D.prototype)", "Object.prototype"); +_assertSame(Object.getPrototypeOf(ctx), CanvasRenderingContext2D.prototype, "Object.getPrototypeOf(ctx)", "CanvasRenderingContext2D.prototype"); t.done(); diff --git a/html/semantics/embedded-content/the-img-element/Image-constructor.html b/html/semantics/embedded-content/the-img-element/Image-constructor.html index 4c1cf2d..3cfef5f 100644 --- a/html/semantics/embedded-content/the-img-element/Image-constructor.html +++ b/html/semantics/embedded-content/the-img-element/Image-constructor.html
@@ -28,10 +28,10 @@ test(function() { assert_equals(Image.name, "Image", "Image name should be Image (not HTMLImageElement)"); - assert_equals(Image.__proto__, Function.prototype, "Image __proto__ is Function prototype"); + assert_equals(Object.getPrototypeOf(Image), Function.prototype, "Image's prototype is Function.prototype"); assert_equals(Image.prototype, HTMLImageElement.prototype, "Image.prototype is same as HTMLImageElement.prototype"); - assert_equals(new Image().__proto__, HTMLImageElement.prototype, "Image __proto__ is HTMLImageElement prototype "); - assert_equals(Image.prototype.__proto__, HTMLElement.prototype, "Image.prototype __proto__ is HTMLElement prototype"); + assert_equals(Object.getPrototypeOf(new Image()), HTMLImageElement.prototype, "new Image()'s prototype is HTMLImageElement.prototype "); + assert_equals(Object.getPrototypeOf(Image.prototype), HTMLElement.prototype, "Image.prototype's prototype is HTMLElement.prototype"); const desc = Object.getOwnPropertyDescriptor(Image, "prototype"); assert_false(desc.configurable, "Image.prototype is not configurable"); diff --git a/html/webappapis/user-prompts/print-manual.html b/html/webappapis/user-prompts/print-manual.html index 3afef1d..67cbd0d 100644 --- a/html/webappapis/user-prompts/print-manual.html +++ b/html/webappapis/user-prompts/print-manual.html
@@ -50,7 +50,7 @@ // t.step_func() does not preserve `this`, which we test below. t.step(() => { out("beforeprint"); - assert_equals(ev.__proto__, Event.prototype); + assert_equals(Object.getPrototypeOf(ev), Event.prototype); assert_equals(this, window); assert_equals(ev.target, window); assert_equals(ev.type, "beforeprint"); @@ -60,7 +60,7 @@ // t.step_func() does not preserve `this`, which we test below. t.step(() => { out("afterprint"); - assert_equals(ev.__proto__, Event.prototype); + assert_equals(Object.getPrototypeOf(ev), Event.prototype); assert_equals(this, window); assert_equals(ev.target, window); assert_equals(ev.type, "afterprint"); diff --git a/orientation-event/motion/create-event.https.html b/orientation-event/motion/create-event.https.html index 7efcf40..e8a2c46 100644 --- a/orientation-event/motion/create-event.https.html +++ b/orientation-event/motion/create-event.https.html
@@ -15,7 +15,7 @@ }); assert_equals(typeof event, 'object'); - assert_equals(event.__proto__, DeviceMotionEvent.prototype); + assert_equals(Object.getPrototypeOf(event), DeviceMotionEvent.prototype); assert_true('type' in event); assert_true('bubbles' in event); diff --git a/orientation-event/orientation/create-event.https.html b/orientation-event/orientation/create-event.https.html index f1e5c0f..a21f956 100644 --- a/orientation-event/orientation/create-event.https.html +++ b/orientation-event/orientation/create-event.https.html
@@ -15,7 +15,7 @@ }); assert_equals(typeof event, 'object'); - assert_equals(event.__proto__, DeviceOrientationEvent.prototype); + assert_equals(Object.getPrototypeOf(event), DeviceOrientationEvent.prototype); assert_true('type' in event); assert_true('bubbles' in event); diff --git a/quirks/blocks-ignore-line-height.html b/quirks/blocks-ignore-line-height.html index 608a7c1..c07f6cf 100644 --- a/quirks/blocks-ignore-line-height.html +++ b/quirks/blocks-ignore-line-height.html
@@ -31,7 +31,7 @@ s.document.close(); [q, a, s].forEach(function(win) { ['style', 'test', 'ref', 's_ref'].forEach(function(id) { - win.__proto__.__defineGetter__(id, function() { return win.document.getElementById(id); }); + Object.getPrototypeOf(win).__defineGetter__(id, function() { return win.document.getElementById(id); }); }); }); diff --git a/quirks/line-height-calculation.html b/quirks/line-height-calculation.html index 7e7f03a..cc5254a 100644 --- a/quirks/line-height-calculation.html +++ b/quirks/line-height-calculation.html
@@ -36,7 +36,7 @@ s.document.close(); [q, a, s].forEach(function(win) { ['style', 'test', 'ref', 's_ref'].forEach(function(id) { - win.__proto__.__defineGetter__(id, function() { return win.document.getElementById(id); }); + Object.getPrototypeOf(win).__defineGetter__(id, function() { return win.document.getElementById(id); }); }); }); diff --git a/quirks/percentage-height-calculation.html b/quirks/percentage-height-calculation.html index e56a03b..a40b8b7 100644 --- a/quirks/percentage-height-calculation.html +++ b/quirks/percentage-height-calculation.html
@@ -42,7 +42,7 @@ s.document.close(); [q, a, s].forEach(function(win) { ['style', 'test'].forEach(function(id) { - win.__proto__.__defineGetter__(id, function() { return win.document.getElementById(id); }); + Object.getPrototypeOf(win).__defineGetter__(id, function() { return win.document.getElementById(id); }); }); }); diff --git a/quirks/table-cell-nowrap-minimum-width-calculation.html b/quirks/table-cell-nowrap-minimum-width-calculation.html index 2ff00b9..25590c6 100644 --- a/quirks/table-cell-nowrap-minimum-width-calculation.html +++ b/quirks/table-cell-nowrap-minimum-width-calculation.html
@@ -36,7 +36,7 @@ s.document.close(); [q, a, s].forEach(function(win) { ['style', 'test', 'ref', 's_ref'].forEach(function(id) { - win.__proto__.__defineGetter__(id, function() { return win.document.getElementById(id); }); + Object.getPrototypeOf(win).__defineGetter__(id, function() { return win.document.getElementById(id); }); }); }); q.title = 'quirks mode'; diff --git a/quirks/table-cell-width-calculation.html b/quirks/table-cell-width-calculation.html index eeb7266..7d76a91 100644 --- a/quirks/table-cell-width-calculation.html +++ b/quirks/table-cell-width-calculation.html
@@ -36,7 +36,7 @@ s.document.close(); [q, a, s].forEach(function(win) { ['style', 'test', 'ref', 's_ref'].forEach(function(id) { - win.__proto__.__defineGetter__(id, function() { return win.document.getElementById(id); }); + Object.getPrototypeOf(win).__defineGetter__(id, function() { return win.document.getElementById(id); }); }); }); q.title = 'quirks mode'; diff --git a/resources/test/tests/functional/idlharness/IdlInterface/test_primary_interface_of.html b/resources/test/tests/functional/idlharness/IdlInterface/test_primary_interface_of.html index 5ce457c..a02f40f 100644 --- a/resources/test/tests/functional/idlharness/IdlInterface/test_primary_interface_of.html +++ b/resources/test/tests/functional/idlharness/IdlInterface/test_primary_interface_of.html
@@ -34,7 +34,7 @@ configurable: true, value: window.Foo }); -Foo.__proto__ = FooParent; +Object.setPrototypeOf(Foo, FooParent); Foo.prototype[Symbol.toStringTag] = "Foo"; var idlArray = new IdlArray();
diff --git a/service-workers/service-worker/ServiceWorkerGlobalScope/fetch-on-the-right-interface.https.any.js b/service-workers/service-worker/ServiceWorkerGlobalScope/fetch-on-the-right-interface.https.any.js index e98a04b..5ca5f65 100644 --- a/service-workers/service-worker/ServiceWorkerGlobalScope/fetch-on-the-right-interface.https.any.js +++ b/service-workers/service-worker/ServiceWorkerGlobalScope/fetch-on-the-right-interface.https.any.js
@@ -6,9 +6,9 @@ 'instance should not have "fetch" method as its property.'); assert_inherits(self, 'fetch', 'ServiceWorkerGlobalScope should ' + 'inherit "fetch" method.'); - assert_own_property(self.__proto__.__proto__, 'fetch', + assert_own_property(Object.getPrototypeOf(Object.getPrototypeOf(self)), 'fetch', 'WorkerGlobalScope should have "fetch" propery in its prototype.'); - assert_equals(self.fetch, self.__proto__.__proto__.fetch, + assert_equals(self.fetch, Object.getPrototypeOf(Object.getPrototypeOf(self)).fetch, 'ServiceWorkerGlobalScope.fetch should be the same as ' + 'WorkerGlobalScope.fetch.'); }, 'Fetch method on the right interface');
diff --git a/service-workers/service-worker/resources/immutable-prototype-serviceworker.js b/service-workers/service-worker/resources/immutable-prototype-serviceworker.js index 346b998..d8a94ad 100644 --- a/service-workers/service-worker/resources/immutable-prototype-serviceworker.js +++ b/service-workers/service-worker/resources/immutable-prototype-serviceworker.js
@@ -2,9 +2,9 @@ let result = []; while (global !== null) { let thrown = false; - let next = global.__proto__; + let next = Object.getPrototypeOf(global); try { - global.__proto__ = {}; + Object.setPrototypeOf(global, {}); result.push('mutable'); } catch (e) { result.push('immutable'); diff --git a/shadow-dom/HTMLSlotElement-interface.html b/shadow-dom/HTMLSlotElement-interface.html index 4327e5d..e22de32 100644 --- a/shadow-dom/HTMLSlotElement-interface.html +++ b/shadow-dom/HTMLSlotElement-interface.html
@@ -14,7 +14,7 @@ test(function () { assert_true('HTMLSlotElement' in window, 'HTMLSlotElement must be defined on window'); - assert_equals(HTMLSlotElement.prototype.__proto__, HTMLElement.prototype, 'HTMLSlotElement should inherit from HTMLElement'); + assert_equals(Object.getPrototypeOf(HTMLSlotElement.prototype), HTMLElement.prototype, 'HTMLSlotElement should inherit from HTMLElement'); assert_true(document.createElement('slot') instanceof HTMLSlotElement, 'slot element should be an instance of HTMLSlotElement'); assert_true(document.createElement('slot') instanceof HTMLElement, 'slot element should be an instance of HTMLElement'); }, 'HTMLSlotElement must be defined on window'); diff --git a/shadow-dom/ShadowRoot-interface.html b/shadow-dom/ShadowRoot-interface.html index e95b1d9..de7ac91 100644 --- a/shadow-dom/ShadowRoot-interface.html +++ b/shadow-dom/ShadowRoot-interface.html
@@ -17,7 +17,7 @@ }, 'Check the existence of ShadowRoot interface'); test(function () { - assert_equals(ShadowRoot.prototype.__proto__, DocumentFragment.prototype, 'ShadowRoot must inherit from DocumentFragment'); + assert_equals(Object.getPrototypeOf(ShadowRoot.prototype), DocumentFragment.prototype, 'ShadowRoot must inherit from DocumentFragment'); }, 'ShadowRoot must inherit from DocumentFragment'); test(function () { diff --git a/svg/extensibility/interfaces/foreignObject-graphics.svg b/svg/extensibility/interfaces/foreignObject-graphics.svg index 000c107..7745e91 100644 --- a/svg/extensibility/interfaces/foreignObject-graphics.svg +++ b/svg/extensibility/interfaces/foreignObject-graphics.svg
@@ -12,7 +12,7 @@ <h:script><![CDATA[ test(function() { var target = document.getElementById('target'); - assert_equals(target.__proto__.__proto__, SVGGraphicsElement.prototype); + assert_equals(Object.getPrototypeOf(Object.getPrototypeOf(target)), SVGGraphicsElement.prototype); }); ]]></h:script> </svg> diff --git a/svg/path/interfaces/SVGAnimatedPathData-removed.svg b/svg/path/interfaces/SVGAnimatedPathData-removed.svg index c8d187c..b9e6217 100644 --- a/svg/path/interfaces/SVGAnimatedPathData-removed.svg +++ b/svg/path/interfaces/SVGAnimatedPathData-removed.svg
@@ -14,7 +14,7 @@ assert_equals(window.SVGAnimatedPathData, undefined); var track = document.getElementById('track'); - assert_equals(track.__proto__, SVGPathElement.prototype); + assert_equals(Object.getPrototypeOf(track), SVGPathElement.prototype); assert_equals(track.pathSegList, undefined); assert_equals(track.normalizedPathSegList, undefined); assert_equals(track.animatedPathSegList, undefined); diff --git a/svg/struct/UnknownElement/interface.svg b/svg/struct/UnknownElement/interface.svg index 862e5fd..987f20c 100644 --- a/svg/struct/UnknownElement/interface.svg +++ b/svg/struct/UnknownElement/interface.svg
@@ -13,7 +13,7 @@ <h:script><![CDATA[ test(function() { var e = document.getElementById("target"); - assert_equals(e.__proto__, SVGUnknownElement.prototype); + assert_equals(Object.getPrototypeOf(e), SVGUnknownElement.prototype); }); ]]></h:script> </svg> diff --git a/trusted-types/Node-multiple-arguments.tentative.html b/trusted-types/Node-multiple-arguments.tentative.html index f6b9798..64b0465 100644 --- a/trusted-types/Node-multiple-arguments.tentative.html +++ b/trusted-types/Node-multiple-arguments.tentative.html
@@ -14,7 +14,7 @@ createScript: t => t, }); function stringify(arg) { - return "textContent" in arg.__proto__ ? arg.textContent : arg.toString() + return "textContent" in Object.getPrototypeOf(arg) ? arg.textContent : arg.toString() } // This test case mirrors the block-Node-multiple-arguments case except diff --git a/trusted-types/block-Node-multiple-arguments.tentative.html b/trusted-types/block-Node-multiple-arguments.tentative.html index f76b358..c3e7671 100644 --- a/trusted-types/block-Node-multiple-arguments.tentative.html +++ b/trusted-types/block-Node-multiple-arguments.tentative.html
@@ -15,7 +15,7 @@ createScript: t => t, }); function stringify(arg) { - return "textContent" in arg.__proto__ ? arg.textContent : arg.toString() + return "textContent" in Object.getPrototypeOf(arg) ? arg.textContent : arg.toString() } // Test all combinations of: diff --git a/url/urlsearchparams-constructor.any.js b/url/urlsearchparams-constructor.any.js index f987837..d482911 100644 --- a/url/urlsearchparams-constructor.any.js +++ b/url/urlsearchparams-constructor.any.js
@@ -29,7 +29,7 @@ test(() => { var params = new URLSearchParams(''); assert_true(params != null, 'constructor returned non-null value.'); - assert_equals(params.__proto__, URLSearchParams.prototype, 'expected URLSearchParams.prototype as prototype.'); + assert_equals(Object.getPrototypeOf(params), URLSearchParams.prototype, 'expected URLSearchParams.prototype as prototype.'); }, "URLSearchParams constructor, empty string as argument") test(() => { diff --git a/workers/SharedWorker-MessageEvent-source.any.js b/workers/SharedWorker-MessageEvent-source.any.js index faf48cf..e47fd06 100644 --- a/workers/SharedWorker-MessageEvent-source.any.js +++ b/workers/SharedWorker-MessageEvent-source.any.js
@@ -1,6 +1,6 @@ // META: global=sharedworker const t = async_test("Make sure that MessageEvent.source is properly set in connect event."); onconnect = t.step_func_done((event) => { - assert_equals(event.__proto__, MessageEvent.prototype); + assert_equals(Object.getPrototypeOf(event), MessageEvent.prototype); assert_equals(event.source, event.ports[0]); }); diff --git a/workers/Worker-constructor-proto.any.js b/workers/Worker-constructor-proto.any.js index 5a4a6aa..297fe6c 100644 --- a/workers/Worker-constructor-proto.any.js +++ b/workers/Worker-constructor-proto.any.js
@@ -2,6 +2,6 @@ test(() => { const proto = {}; assert_equals(String(Object.getPrototypeOf(WorkerLocation)).replace(/\n/g, " ").replace(/\s\s+/g, " "), "function () { [native code] }"); - WorkerLocation.__proto__ = proto; + Object.setPrototypeOf(WorkerLocation, proto); assert_equals(Object.getPrototypeOf(WorkerLocation), proto); }, 'Tests that setting the proto of a built in constructor is not reset.'); diff --git a/xhr/responsexml-document-properties.htm b/xhr/responsexml-document-properties.htm index c27a448..cb2edb7 100644 --- a/xhr/responsexml-document-properties.htm +++ b/xhr/responsexml-document-properties.htm
@@ -39,7 +39,7 @@ function runTest(name, value){ test(function(){ if (name == "all") { - assert_equals(client.responseXML[name].__proto__, value.prototype) + assert_equals(Object.getPrototypeOf(client.responseXML[name]), value.prototype) } else { assert_equals(client.responseXML[name], value) }